package com.vict.config;

import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.support.CronTrigger;

public class CompleteScheduleConfig {
    private static ThreadPoolTaskScheduler threadPoolTaskScheduler;
    static {
        threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
        threadPoolTaskScheduler.setPoolSize(10);
        threadPoolTaskScheduler.initialize();
    }

    public static void startJob(Runnable task, String cron){
        threadPoolTaskScheduler.schedule(task, new CronTrigger(cron));
    }
}
